package org.idea.spring.framework.tx;

import org.idea.spring.framework.tx.dao.UserDao;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.transaction.support.AbstractPlatformTransactionManager;

import javax.annotation.Resource;

/**
 * @Author linhao
 * @Date created in 6:37 下午 2021/5/20
 */
@SpringBootApplication
public class TxApplication implements CommandLineRunner {

    @Resource
    private ApplicationContext applicationContext;

    public static void main(String[] args) {
        SpringApplication.run(TxApplication.class);
    }

    @Override
    public void run(String... args) throws Exception {
        UserDao userDao = applicationContext.getBean(UserDao.class);
        userDao.doInsertTest();
    }
}
